
package edu.tongji.jiaowu.dao.jdbc;
 
import java.util.List;

import edu.tongji.jiaowu.dao.PlanTeachingDao;
import com.tongji.quickCRUDQ.define.Row;
import com.tongji.quickCRUDQ.model.CommonBean;
import com.tongji.quickCRUDQ.dao.jdbc.BaseDaoJdbc;

public class PlanTeachingDaoJdbc extends BaseDaoJdbc implements PlanTeachingDao {
	String tableName="T_PLAN_TEACHING";
	String beanName="planTeaching";
	
	public CommonBean createPlanTeaching(){
		CommonBean planTeachings=this.createBean(tableName,beanName);
                return planTeachings;		
	}
	
/*
	public CommonBean findPlanTeachings(String refid) {
		CommonBean planTeachings=this.createPlanTeaching();
		String sql="select * from T_PLAN_TEACHING where refid=?";
		List data=this.getCommonDao().select(sql,new String[]{refid});
		planTeachings.addData(data);
                return planTeachings;
       }
*/
	public CommonBean findPlanTeachingById(String id) {
		CommonBean planTeachings=this.createPlanTeaching();
		String sql="select * from T_PLAN_TEACHING where id=?";
		List data=this.getCommonDao().select(sql,new String[]{id});
		planTeachings.addData(data);
    return planTeachings;
  }
  
	public CommonBean findAllPlanTeachings() {
		CommonBean planTeachings=this.createPlanTeaching();
		String sql="select * from T_PLAN_TEACHING ";
		List data=this.getCommonDao().select(sql,new String[]{});
		planTeachings.addData(data);
    return planTeachings;
  }
	public void insertPlanTeaching(CommonBean planTeachingBean){
		List data=planTeachingBean.getData();
		Row row=this.getRow(tableName);
		this.getCommonDao().templateBatchInsert(row,data,this.getIdGenerator());
	}
	public void updatePlanTeaching(CommonBean planTeachingBean){
		List data=planTeachingBean.getData();
		Row row=this.getRow(tableName);
		this.getCommonDao().templateBatchUpdate(row,data);
	}
}

